{extend name='common@layout/seller' /}
{block name="left"}{include file='store/left'}{/block}
{block name="breadcrumb"}
<div class="ncsc-path"><i class="icon-desktop"></i>商家管理中心<i class="icon-angle-right"></i>店铺<i class="icon-angle-right"></i>店铺设置</div>
{/block}
{block name='content'}
{include file='store/tab'}
<div class="ncsc-form-default">
    <form method="post"  action="/index.php?s=seller/store/setting" enctype="multipart/form-data" id="my_store_form">
   	 <input  type='hidden' name="grade_id" id="storeLablePic" nc_type="haha"/>
        <dl>
            <dt>店铺等级：</dt>
            <dd>
                <p>{$store.grade_name|default=''}</p>
            </dd>
        </dl>
        <dl>
            <dt>店铺名称：</dt>
            <dd>
                <input type="text" value="{$store.name}" name="name" class="text w400">
            </dd>
        </dl>


        <dl>
            <dt>店铺logo：</dt>
            <dd>
                <div class="ncsc-upload-thumb store-logo">
                    <p>          <img alt="{$store.name}" src="/uploads/{$store.label}" nc_type="store_label" />
                    </p>
                </div>
                <div class="ncsc-upload-btn"> <a href="javascript:void(0);"><span>
                            <input type="file" hidefocus="true" size="1" class="input-file" name="label" id="storeLablePic" nc_type="change_store_label"/>
                        </span>
                        <p><i class="icon-upload-alt"></i>图片上传</p>
                    </a> </div>
                <p class="hint">此处理店铺页logo；<br/><span style="color:orange;">建议使用宽200像素-高60像素内的GIF或PNG透明图片；点击下方"提交"按钮后生效。</span></p>
            </dd>
        </dl>
        <dl>
            <dt>QQ：</dt>
            <dd>
                <input class="w200 text" name="qq" type="text"  id="store_qq" value="{$store.qq ?? ''}" />
            </dd>
        </dl>
        <dl>
            <dt>店铺电话：</dt>
            <dd>
                <input class="text w200" name="phone" maxlength="20" type="text"  id="store_phone" value="{$store.phone ?? ''}" />
            </dd>
        </dl>
        <dl>
            <dt>SEO关键字：</dt>
            <dd>
                <p>
                    <input class="text w400" name="keywords" type="text"  value="{$store.keywords ?? ''}" />
                </p>
                <p class="hint">用于店铺搜索引擎的优化，关键字之间请用英文逗号分隔</p>
            </dd>
        </dl>
        <dl>
            <dt>SEO店铺描述：</dt>
            <dd>
                <p>
                    <textarea name="description" rows="3" class="textarea w400" id="remark_input" >{$store.description ?? ''}</textarea>
                </p>
                <p class="hint">用于店铺搜索引擎的优化，建议120字以内</p>
            </dd>
        </dl>
        <div class="bottom">
            <label class="submit-border"><input type="submit" class="submit" value="提交" /></label>
        </div>
    </form>
</div>
<script type="text/javascript" src="/old/data/resource/js/common_select.js?v1.2" charset="utf-8"></script>
<script type="text/javascript" src="/old/data/resource/js/ajaxfileupload/ajaxfileupload.js?v1.2"></script>
<script type="text/javascript" src="/old/data/resource/js/jquery.Jcrop/jquery.Jcrop.js?v1.2"></script>
<link href="/old/data/resource/js/jquery.Jcrop/jquery.Jcrop.min.css?v1.2" rel="stylesheet" type="text/css" id="cssfile2" />
<script type="text/javascript">
    var SITEURL = "{$Think.config.url_base}";
    function call_back(picname) {
        $('#store_avatar').val(picname);
        $('img[nc_type="store_avatar"]').attr('src', SITEURL + '/old/data/upload/shop/store/' + picname);
        $('#_pic').val('');
    }
    $(function () {
        $('#_pic').change(uploadChange);
        function uploadChange() {
            var filepatd = $(this).val();
            var extStart = filepatd.lastIndexOf(".");
            var ext = filepatd.substring(extStart, filepatd.lengtd).toUpperCase();
            if (ext != ".PNG" && ext != ".GIF" && ext != ".JPG" && ext != ".JPEG") {
                alert("file type error");
                $(this).attr('value', '');
                return false;
            }
            if ($(this).val() == '')
                return false;
            ajaxFileUpload();
        }
        function ajaxFileUpload()
        {
            $.ajaxFileUpload
                    (
                            {
                                url: 'index.php?act=cut&op=pic_upload&form_submit=ok&uploadpath=shop/store',
                                secureuri: false,
                                fileElementId: '_pic',
                                dataType: 'json',
                                success: function (data, status)
                                {
                                    if (data.status == 1) {
                                        ajax_form('cutpic', '裁剪', 'index.php?act=cut&op=pic_cut&x=100&y=100&resize=1&url=' + data.url, 680);
                                    } else {
                                        alert(data.msg);
                                        $('#_pic').bind('change', uploadChange);
                                    }
                                },
                                error: function (data, status, e)
                                {
                                    alert('上传失败');
                                    $('#_pic').bind('change', uploadChange);
                                }
                            }
                    )
        }
        ;
        regionInit("region");
        $('input[nc_type="change_store_banner"]').change(function () {
            var src = getFullPath($(this)[0]);
            $('img[nc_type="store_banner"]').attr('src', src);
        });
        $('input[nc_type="change_store_label"]').change(function () {
            var src = getFullPath($(this)[0]);
            $('img[nc_type="store_label"]').attr('src', src);
        });
        $('input[class="edit_region"]').click(function () {
            $(this).css('display', 'none');
            $('#area_id').val('');
            $(this).parent().children('select').css('display', '');
            $(this).parent().children('span').css('display', 'none');
        });
        jQuery.validator.addMethod("domain", function (value, element) {
            return this.optional(element) || /^[\w\-]+$/i.test(value);
        }, "");
        $('#my_store_form').validate({
            submitHandler: function (form) {
                ajaxpost('my_store_form', '', '', 'onerror')
            },
            rules: {
            },
            messages: {
            }
        });

        $('#a_store_code').click(function () {
            $('#img_store_code').attr('src', '');
            $.getJSON($(this).attr('href'), function (data) {
                $('#img_store_code').attr('src', SITEURL + '/old/data/upload/shop/store/' + data);
            });
            return false;
        });

    });
</script>
{/block}